/*
 * cafe-layout.js
 * Created by PanRS on 2017年5月31日 下午5:09:57. 
 * Copyright (C) 2017 NRIET
 * Description: 
 * 	布局控制模块
 * 	配合layout.css
 */

;+define(function(){
	
	var sidebar = $('div.cafe-sidebar'),
		container = $('div.cafe-container'),
		sidswitch = $('div.cafe-sidebar-switch');
	
	var CFLayout = function(setting){
		var opts = {
				sideIsHidd: false
		}
		
		this.configs = $.extend({}, opts, setting);
		this.init();
	}
	
	
	CFLayout.prototype = {
		init: function(){
			this.evs();
		},
		evs: function(){
			var _this = this,
				cfs = _this.configs;
			
			container.removeAttr('style');
			sidebar.animate({left: '0px'}, 100);
			sidebar.data('ishidden', cfs.hidden).attr('data-ishidden',  cfs.hidden);
			sidebar.data('isdisable', cfs.disable).attr('data-isdisable',  cfs.disable);
			container.data('sidebar', cfs.disable).attr('data-sidebar',  cfs.disable);
			
			sidswitch.addClass(sidebar.data('isdisable') ?'' : 'on');
			
			
		}
	};
	
	return {
		cfLayout: CFLayout
	};
	
});